/**
 * Copyright � 2012 GestureSoft. ALL RIGHTS RESERVED.
 * This file contains proprietary and GestureSoft CONFIDENTIAL Information.
 * Use, disclosure or reproduction is prohibited.
 * 
 * @fileName SolidActionBarSkin.as
 * @creationDate Aug 8, 2012
 * @author 
 * @version 1.0
 */
package com.gesturesoft.imultimax.skin
{
	
	import flash.display.BitmapData;
	import flash.display.GradientType;
	import flash.display.Shape;
	import flash.geom.Matrix;
	
	import mx.core.DPIClassification;
	import mx.core.FlexGlobals;
	import mx.styles.CSSStyleDeclaration;
	
	import spark.skins.mobile.ActionBarSkin;

	//[Embed(source="../imgs/panelHeaderGradient.png")]
	public class SolidActionBarSkin extends ActionBarSkin
	{
		
		override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
		{
			
			var chromeColor:uint = getStyle("chromeColor");
			var backgroundAlphaValue:Number = getStyle("backgroundAlpha");
			var ss:CSSStyleDeclaration = styleManager.getStyleDeclaration('.myActionBar');
			// border size is twice as big on 320
			var myShape:Shape = new Shape();
			var borderSize:int = 1;
			if (applicationDPI == DPIClassification.DPI_160)
				borderSize = 1;
			
			
			graphics.beginFill(chromeColor, backgroundAlphaValue);

			//graphics.drawRect(0, borderSize, unscaledWidth, unscaledHeight - (borderSize * 2));
		
			//graphics.clear();
			var gradientBoxMatrix:Matrix = new Matrix();
			//gradientBoxMatrix.createGradientBox(200, 40, 0, 0, 0);
			var boxWidth:Number = 50;
			var boxHeight:Number = 60;
			var boxRotation:Number = Math.PI/2; // 90�?
			var tx:Number = 25;
			var ty:Number = 0;
			gradientBoxMatrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);
			//graphics.beginGradientFill(GradientType.LINEAR, [0xd2d2d5, 0x0, 0x0], [.1, .1, .1],[0,128,255], gradientBoxMatrix);
			graphics.beginGradientFill(GradientType.LINEAR, [ss.getStyle("gradient1"), ss.getStyle("gradient2")], [1, 1],[.50, 1]);
			graphics.drawRect(0, borderSize, unscaledWidth, unscaledHeight - (borderSize * 2));
			/*graphics.beginGradientFill(GradientType.LINEAR, [0xffffff, 0x0, 0x666766], [.1, .08, 0],[80,0,255], gradientBoxMatrix);
			graphics.drawRect(0, borderSize, unscaledWidth, unscaledHeight - (borderSize * 2));*/
			graphics.endFill();
			
			//super.drawBackground(unscaledWidth, unscaledHeight);
			
		}
		
	}

}